<html>
	<head>
		<meta charset="utf-8">
		<title>Layui</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<!--		<link rel="stylesheet" href="http://unpkg.com/layui@2.6.8/dist/css/layui.css">-->
		<link rel="stylesheet" href="/layui/css/layui.css">
		<!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
	</head>

	<body>

		<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
			<legend>5.1大放送</legend>
		</fieldset>
		<form class="layui-form" action="http://localhost:8080/loginUser" method="post" name="example">
			<div class="layui-form-item">
				<label class="layui-form-label">姓名*</label>
				<div class="layui-input-inline">
					<input type="text" name="username" class="layui-input" lay-verify="title">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">日期*</label>
				<div class="layui-input-inline">
					<input type="text" class="layui-input" name="birthday" id="test1" lay-verify="date"
						placeholder="yyyy-MM-dd">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">选择框</label>
				<div class="layui-input-inline">
					<select name="city">
						<option value=""></option>
						<option value="0">北京</option>
						<option value="1">上海</option>
						<option value="2">广州</option>
						<option value="3">深圳</option>
						<option value="4">杭州</option>
					</select>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">复选框</label>
				<div class="layui-input-block">
					<input type="checkbox" name="like[write]" title="写作">
					<input type="checkbox" name="like[read]" title="阅读" checked>
				</div>
			</div>
			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn" lay-submit id="submit">立即提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>
		</form>


		<script src="/layui/layui.js"></script>
		<script>
			layui.use(['form', 'layedit', 'laydate'], function() {

				var laydate = layui.laydate,
					form = layui.form;

				//执行一个laydate实例
				laydate.render({
					elem: '#test1' //指定元素
				});

				//自定义验证规则
				form.verify({
					title: function(value) {
						if (value.length < 1) {
							return '标题至少得1个字符啊';
						}
					}

				});
			});
		</script>
	</body>
</html>
